/*
* Authors: Savenko Maria
*           * * *
*           * * *
* This file contains some general functions for manipulating and visualizing graphs.
*/



#include "stdafx.h"


graph_helper::graph_helper() {
}

void graph_helper::print_graph(graph_t & g) {

	graph_traits<graph_t>::vertex_iterator i, iend;
	graph_traits<graph_t>::adjacency_iterator j, jend;
    bool if_first = true;

	for(tie(i, iend) = vertices(g); i != iend; ++i) {
		cout << g[*i].name;
		for (tie(j, jend) = adjacent_vertices(*i, g); j != jend; ++j)
		{
            if (if_first) 
                cout << " is adjacent to " << g[*j].name ;
            else
                cout <<", "  << g[*j].name;
            if_first = false;
		}
	    cout << endl;
        if_first = true;
	}
}


void graph_helper::print_graph(graph_t & g, std::string name){

    cout << "          Graph " << name << ": " << endl;
    print_graph(g);
}